package net.cl.db;

import net.cl.db.handler.JavaTypeHandler;
import net.cl.utils.StringUtil;

public class ColumnProperties {

	private String columnName;
	private int jdbcType;
	private String jdbcTypeName;
	private boolean isNullable;
	private int length;
	private int scale;
	private boolean isAutoIncrement;
	private boolean isPrimaryKey;

	public String getColumnName() {
		return columnName;
	}
	
	public String getJavaFieldsName(boolean firstUpper) {
		return StringUtil.getCamelCase(columnName, firstUpper);
	}

	public void setColumnName(String columnName) {
		this.columnName = columnName;
	}

	public int getJdbcType() {
		return jdbcType;
	}

	public void setJdbcType(int jdbcType) {
		this.jdbcType = jdbcType;
	}

	public String getJdbcTypeName() {
		return jdbcTypeName;
	}
	
	public String getJavaType() {
		return JavaTypeHandler.getJavaType(getJdbcType(), getScale());
	}

	public void setJdbcTypeName(String jdbcTypeName) {
		this.jdbcTypeName = jdbcTypeName;
	}

	public boolean isNullable() {
		return isNullable;
	}

	public void setNullable(boolean isNullable) {
		this.isNullable = isNullable;
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	public int getScale() {
		return scale;
	}

	public void setScale(int scale) {
		this.scale = scale;
	}

	public boolean isAutoIncrement() {
		return isAutoIncrement;
	}

	public void setAutoIncrement(boolean isAutoIncrement) {
		this.isAutoIncrement = isAutoIncrement;
	}

	public boolean isPrimaryKey() {
		return isPrimaryKey;
	}

	public void setPrimaryKey(boolean isPrimaryKey) {
		this.isPrimaryKey = isPrimaryKey;
	}

}
